<?php
/*
	Sponsor Manager (class.sections.php file)
    Copyright (C) <Fri Feb 08 21:37:49 CET 2008>  Marcos Ramírez <marcosramirez@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

 */

class Section {

	function __construct($section) {
		if ($_SESSION['nouser']==1) // No users on system, create one (must be FIRST if condition)
			$this->section='newuser';
		elseif ($_SESSION['loggedin']!=1) // Not loged, get to login page.
			$this->section='login';
		else // Else ... go where you want.
			$this->section=$section;
	}

	public function loadsection () {
		global $Cfg;
		
		$template=$Cfg['Sys']['defaultTemplate'];
		switch (strtolower($this->section)) {
			case 'login':
				include 'templates/'.$template.'/login.php';
				break;

			case 'checklogin':
				$user->checklogin($_POST['userlogin'], $_POST['userpass']);
				break;
				
			case 'users':
				include 'templates/'.$template.'/users.php';
				break;
				
			case 'example':
				include 'templates/'.$template.'/example.php';
				break;
				
			case 'addcategory':
				include 'templates/'.$template.'/addcategory.php';
				break;
				
			case 'main':
				include 'templates/'.$template.'/main.php';
				break;
			
			case 'sponsors'	:
				include 'templates/'.$template.'/sponsors.php';
				break;
			
			case 'domains':
				include 'templates/'.$template.'/domains.php';
				break;
				
			case 'promotions':
					include 'templates/'.$template.'/promotions.php';
				break;
				
			case 'addsponsor':
				include 'templates/'.$template.'/addsponsor.php';
				break;
				
			case 'addcategory':
				include 'templates/'.$template.'/addcategory.php';
				break;

			case 'categories':
				include 'templates/'.$template.'/categories.php';
				break;
				
			case 'adddomain':
				include 'templates/'.$template.'/adddomain.php';
				break;
				
			case 'addip':
				include 'templates/'.$template.'/addip.php';
				break;

			case 'addpromotionaltype':
				include 'templates/'.$template.'/addpromotype.php';
				break;

			case 'addpromotionalcontent':
				include 'templates/'.$template.'/addpromotionalcontent.php';
				break;
				
			case 'developersteam':
				include 'templates/'.$template.'/developers.php';
				break;

				default:
				include 'templates/'.$template.'/main.php';
				break;
		}
		
	}

}

?>